﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Model
{
    /// <summary>
    /// 实体工厂
    /// </summary>
    public static class EntityFactory
    {
        public static T Create<T>() where T : Disposer
        {
            T disposer = Activator.CreateInstance<T>();
            ObjectEvents.Instance.Awake(disposer);
            return disposer;
        }

        public static T Create<T, A>(A a) where T :Disposer
        {
            T disposer =  Activator.CreateInstance<T>();
            ObjectEvents.Instance.Awake(disposer, a);
            return disposer;
        }

        public static T Create<T, A,B>(A a,B b) where T : Disposer
        {
            T disposer = Activator.CreateInstance<T>();
            ObjectEvents.Instance.Awake(disposer, a, b);
            return disposer;
        }

        public static T Create<T, A,B,C>(A a,B b,C c) where T : Disposer
        {
            T disposer = Activator.CreateInstance<T>();
            ObjectEvents.Instance.Awake(disposer, a, b, c);
            return disposer;
        }

    }
}
